#pragma once

#include "Being.h"
#include "Wizard.h"
#include "Monstr.h"
#include "MyThread.h"
#include "DataTransAI.h"
#include "Position.h"

class AIPlayer: public CMyThread
{
private:
	int CreateSpells[45][2][2];
	double FactorSpells[45][2][2];

	Position * ROOT;
	int turn;

public:
	AIPlayer(void);

	DataTransAI DTAI;

	DWORD ThreadFunc();

	~AIPlayer(void);

private:

	void CounterCreateSpell(Position * pos, GestWizard * gests);

	void AllocationGestures(AllocGest * allocgest, int group);

	void Tree(Position * root, GestWizard gests);

	Position * CreatePosition(Position * root, int level, int group, int * LH[2], int * RH[2]);

	bool CheckExeptionPosition(int lh, int rh);

	void WhatSpellCreate(Wizard * Player);

	int GetSpellType(int spell);

	void DetourTree(Position * root);

	void PositionEstimation(Position * pos);

	void ChoisMove(AllocGest * allocgest);

	void Init();
};
